(0) Obligation:

The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(1, 1).


The TRS R consists of the following rules:

zeroscons(0, n__zeros)
tail(cons(X, XS)) → activate(XS)
zerosn__zeros
activate(n__zeros) → zeros
activate(X) → X

Rewrite Strategy: INNERMOST

(1) TrsToWeightedTrsProof (BOTH BOUNDS(ID, ID) transformation)

Transformed TRS to weighted TRS

(2) Obligation:

The Runtime Complexity (innermost) of the given CpxWeightedTrs could be proven to be BOUNDS(1, 1).


The TRS R consists of the following rules:

zeroscons(0, n__zeros) [1]
tail(cons(X, XS)) → activate(XS) [1]
zerosn__zeros [1]
activate(n__zeros) → zeros [1]
activate(X) → X [1]

Rewrite Strategy: INNERMOST

(3) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)

Infered types.

(4) Obligation:

Runtime Complexity Weighted TRS with Types.
The TRS R consists of the following rules:

zeroscons(0, n__zeros) [1]
tail(cons(X, XS)) → activate(XS) [1]
zerosn__zeros [1]
activate(n__zeros) → zeros [1]
activate(X) → X [1]

The TRS has the following type information:
zeros :: n__zeros:cons
cons :: 0 → n__zeros:cons → n__zeros:cons
0 :: 0
n__zeros :: n__zeros:cons
tail :: n__zeros:cons → n__zeros:cons
activate :: n__zeros:cons → n__zeros:cons

Rewrite Strategy: INNERMOST

(5) CompletionProof (UPPER BOUND(ID) transformation)

The TRS is a completely defined constructor system, as every type has a constant constructor and the following rules were added:

tail(v0) → null_tail [0]

And the following fresh constants:

null_tail

(6) Obligation:

Runtime Complexity Weighted TRS where all functions are completely defined. The underlying TRS is:

Runtime Complexity Weighted TRS with Types.
The TRS R consists of the following rules:

zeroscons(0, n__zeros) [1]
tail(cons(X, XS)) → activate(XS) [1]
zerosn__zeros [1]
activate(n__zeros) → zeros [1]
activate(X) → X [1]
tail(v0) → null_tail [0]

The TRS has the following type information:
zeros :: n__zeros:cons:null_tail
cons :: 0 → n__zeros:cons:null_tail → n__zeros:cons:null_tail
0 :: 0
n__zeros :: n__zeros:cons:null_tail
tail :: n__zeros:cons:null_tail → n__zeros:cons:null_tail
activate :: n__zeros:cons:null_tail → n__zeros:cons:null_tail
null_tail :: n__zeros:cons:null_tail

Rewrite Strategy: INNERMOST

(7) CpxTypedWeightedTrsToRntsProof (UPPER BOUND(ID) transformation)

Transformed the TRS into an over-approximating RNTS by (improved) Size Abstraction.
The constant constructors are abstracted as follows:

0 => 0
n__zeros => 0
null_tail => 0

(8) Obligation:

Complexity RNTS consisting of the following rules:

activate(z) -{ 1 }→ X :|: X >= 0, z = X
activate(z) -{ 1 }→ zeros :|: z = 0
tail(z) -{ 1 }→ activate(XS) :|: z = 1 + X + XS, X >= 0, XS >= 0
tail(z) -{ 0 }→ 0 :|: v0 >= 0, z = v0
zeros -{ 1 }→ 0 :|:
zeros -{ 1 }→ 1 + 0 + 0 :|:

Only complete derivations are relevant for the runtime complexity.

(9) CompleteCoflocoProof (EQUIVALENT transformation)

Transformed the RNTS (where only complete derivations are relevant) into cost relations for CoFloCo:

eq(start(V),0,[zeros(Out)],[]).
eq(start(V),0,[tail(V, Out)],[V >= 0]).
eq(start(V),0,[activate(V, Out)],[V >= 0]).
eq(zeros(Out),1,[],[Out = 1]).
eq(tail(V, Out),1,[activate(XS1, Ret)],[Out = Ret,V = 1 + X1 + XS1,X1 >= 0,XS1 >= 0]).
eq(zeros(Out),1,[],[Out = 0]).
eq(activate(V, Out),1,[zeros(Ret1)],[Out = Ret1,V = 0]).
eq(activate(V, Out),1,[],[Out = X2,X2 >= 0,V = X2]).
eq(tail(V, Out),0,[],[Out = 0,V1 >= 0,V = V1]).
input_output_vars(zeros(Out),[],[Out]).
input_output_vars(tail(V,Out),[V],[Out]).
input_output_vars(activate(V,Out),[V],[Out]).

CoFloCo proof output:
Preprocessing Cost Relations
=====================================

#### Computed strongly connected components
0. non_recursive : [zeros/1]
1. non_recursive : [activate/2]
2. non_recursive : [tail/2]
3. non_recursive : [start/1]

#### Obtained direct recursion through partial evaluation
0. SCC is partially evaluated into zeros/1
1. SCC is partially evaluated into activate/2
2. SCC is partially evaluated into tail/2
3. SCC is partially evaluated into start/1

Control-Flow Refinement of Cost Relations
=====================================

### Specialization of cost equations zeros/1
* CE 5 is refined into CE [11]
* CE 6 is refined into CE [12]


### Cost equations --> "Loop" of zeros/1
* CEs [11] --> Loop 8
* CEs [12] --> Loop 9

### Ranking functions of CR zeros(Out)

#### Partial ranking functions of CR zeros(Out)


### Specialization of cost equations activate/2
* CE 10 is refined into CE [13]
* CE 9 is refined into CE [14,15]


### Cost equations --> "Loop" of activate/2
* CEs [15] --> Loop 10
* CEs [13,14] --> Loop 11

### Ranking functions of CR activate(V,Out)

#### Partial ranking functions of CR activate(V,Out)


### Specialization of cost equations tail/2
* CE 7 is refined into CE [16,17]
* CE 8 is refined into CE [18]


### Cost equations --> "Loop" of tail/2
* CEs [17] --> Loop 12
* CEs [16] --> Loop 13
* CEs [18] --> Loop 14

### Ranking functions of CR tail(V,Out)

#### Partial ranking functions of CR tail(V,Out)


### Specialization of cost equations start/1
* CE 2 is refined into CE [19,20]
* CE 3 is refined into CE [21,22,23]
* CE 4 is refined into CE [24,25]


### Cost equations --> "Loop" of start/1
* CEs [19,20,21,22,23,24,25] --> Loop 15

### Ranking functions of CR start(V)

#### Partial ranking functions of CR start(V)


Computing Bounds
=====================================

#### Cost of chains of zeros(Out):
* Chain [9]: 1
with precondition: [Out=0]

* Chain [8]: 1
with precondition: [Out=1]


#### Cost of chains of activate(V,Out):
* Chain [11]: 2
with precondition: [V=Out,V>=0]

* Chain [10]: 2
with precondition: [V=0,Out=1]


#### Cost of chains of tail(V,Out):
* Chain [14]: 0
with precondition: [Out=0,V>=0]

* Chain [13]: 3
with precondition: [Out=1,V>=1]

* Chain [12]: 3
with precondition: [Out>=0,V>=Out+1]


#### Cost of chains of start(V):
* Chain [15]: 3
with precondition: []


Closed-form bounds of start(V):
-------------------------------------
* Chain [15] with precondition: []
- Upper bound: 3
- Complexity: constant

### Maximum cost of start(V): 3
Asymptotic class: constant
* Total analysis performed in 44 ms.

(10) BOUNDS(1, 1)